package com.joysuch.wwyt.risk.controller;


import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.risk.entity.dto.RiskLevelDefaultControlLevelDto;
import com.joysuch.wwyt.risk.service.RiskLevelDefaultControlLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author heqifeng
 * @since 2021-09-02
 */
@RestController
@RequestMapping("/risk/risk-default-control-level")
@Api(tags = "双预防-管控层级配置")
public class RiskLevelDefaultControlLevelController {
    @Autowired
    RiskLevelDefaultControlLevelService service;

    @RequestMapping("save")
    @ApiOperation("保存")
    public ResultBean save(@RequestBody RiskLevelDefaultControlLevelDto[] levelDtos){
        return ResultBean.success(service.insertOrUpdate(levelDtos));
    }

    @RequestMapping("getAll")
    @ApiOperation("获取")
    public ResultBean getAll(){
        List<RiskLevelDefaultControlLevelDto> levelDtos = service.findAll();
        return ResultBean.success(levelDtos);
    }

}